package com.liruo.treasureattic.common.httpmsg.exception;

import com.liruo.treasureattic.common.httpmsg.result.Errno;

import java.io.Serial;

/**
 * @Author:liruo
 * @Date:2023-02-11-04:48:39
 * @Desc
 */
public class ApiException extends RuntimeException{
    @Serial
    private static final long serialVersionUID = 1607605412340124030L;
    private final int code;
    public ApiException(int code, String message) {
        super(message);
        this.code = code;
    }
    public ApiException(Errno code, String message) {
        this(code.getCode(),code.getMsg() + ", " + message);
    }

    public ApiException(Errno code) {
        this(code.getCode(), code.getMsg());
    }
    public int getCode() {
        return code;
    }
}
